<template>
  <!--<div>login
    <router-link to="/">back</router-link>
  </div>-->
  <div>
    用户:
    <Input v-model="username" style="width: 300px" /><br><br> 
    密码:
    <Input v-model="password" style="width: 300px" /><br><br>
    email:
    <Input v-model="email" style="width: 300px" /><br><br> 
    phone:
    <Input v-model="phone" style="width: 300px" /><br><br>
    <Button type="primary" style="width: 330px" @click="register">注册</Button>
  </div>

</template>
<script>
import service from '../../service/index'
export default {
  name: "register",
  // mounted() {
  //   console.log(this.$route.query.id)
  // },
  data:()=>{
    return{
      username:'',
      password:'',
      email:'',
      phone:''
    }
  },
  methods: {
    register (e) {
      console.log(this.username, this.password, this.email, this.phone)
      service.post('/v1/register',{
        body: JSON.stringify({
          username: this.username,
          password: this.password,
          email: this.email,
          phone:this.phone
        })
      })
      .then((res)=>{
          if(res.retcode === -90002){
              alert('注册失败')
          }
        console.log(res)
      })
    }
  }
};
</script>

<style lang="scss" scoped>

</style>
